﻿#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QWidget>
#include<QTimer>

#include"gamewindow.h"
#include"snake.h"

struct apple
{
    int x,y;
};

namespace Ui {
class GameWindow;
}

class GameWindow : public QWidget
{
    Q_OBJECT
private:
    Snake m_sanke;   //蛇
    apple m_apple;   //苹果
    QTimer* m_gameTimer;  //游戏定时器

public:
    explicit GameWindow(QWidget *parent = nullptr);
    ~GameWindow();
    void paintEvent(QPaintEvent *event);
    void initData();
private slots:
    void onTimeOut();
public:
    void startGame();

private:
    Ui::GameWindow *ui;
};

#endif // GAMEWINDOW_H
